package com.tianji.learning.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tianji.learning.domain.po.PointsRecord;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Cammy
 * @description 针对表【points_record(学习积分记录，每个月底清零)】的数据库操作Mapper
 * @createDate 2025-02-24 03:58:44
 * @Entity generator.domain.PointsRecord
 */
public interface PointsRecordMapper extends BaseMapper<PointsRecord> {

    @Select("SELECT SUM(points) FROM points_record ${ew.customSqlSegment}")
    Integer queryUserPointsByTypeAndDate(LambdaQueryWrapper<PointsRecord> lambdaQueryWrapper);

    /**
     * 查询我的今日积分
     * @param queryWrapper
     * @return
     */
    @Select("select type, sum(points) as points from points_record ${ew.customSqlSegment}")
    List<PointsRecord> queryUserPointsByDate(LambdaQueryWrapper<PointsRecord> queryWrapper);
}




